package com.example.demo.service;

import com.example.demo.entity.UserInfo;
import com.example.demo.mapper.UserMapper;
import org.apache.tomcat.util.buf.UEncoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public int reg(UserInfo userInfo){
        return userMapper.reg(userInfo);
    }

    public UserInfo login(String username){
        return userMapper.login(username);
    }

    public int reg2(UserInfo userInfo){
        return userMapper.reg2(userInfo);
    }

    public UserInfo selectByUsernameAndEmail(String username, String email) {
        return userMapper.selectByUsernameAndEmail(username,email);
    }
    public int updatePassword(String username,String email,String password){
        return userMapper.updatePassword(username,email,password);
    }

    public UserInfo selectByUsername(String username) {
        return userMapper.selectByUsername(username);
    }

    public int filePath(String image_path, Integer id) {
        return userMapper.filePath(image_path,id);
    }

    public UserInfo getImagePath(Integer id) {
        return userMapper.getImagePath(id);
    }
}
